#ifndef PRR_H_
#define PRR_H_

#include "recbase.h"
#include "rectype.h"
#include "stdffield.h"
#include "chararray.h"
#include <vector>
#include <string>
#include <map>

namespace opsrc {
    namespace stdf {

        class Prr : public opsrc::stdf::RecBase
        {
        public:
            Prr(stdf_rec stdfrec,  int reclen, std::ios::pos_type fileRecFirstBytePosition, int orderindex, endian e, char* buf);
            virtual ~Prr();

            const StdfField<int> getHeadNumber() const;
            void setHeadNumber(StdfField<int> headnum);

            const StdfField<int> getSiteNumber() const;
            void setSiteNumber(StdfField<int> sitenum);

            const StdfField<vector<bool> > getPartFlag() const;
            void setPartFlag(StdfField<vector<bool> > partflag);

            const StdfField<int> getNumberOfTests() const;
            void setNumberOfTests(StdfField<int> numtest);

            const StdfField<int> getHardBin() const;
            void setHardBin(StdfField<int> hardbin);

            const StdfField<int> getSoftBin() const;
            void setSoftBin(StdfField<int> softbin);

            const StdfField<int> getXCoordinate() const;
            void setXCoordinate(StdfField<int> xcoord);

            const StdfField<int> getYCoordinate() const;
            void setYCoordinate(StdfField<int> ycoord);

            const StdfField<long> getTestTime() const;
            void setTestTime(StdfField<long> testt);

            const StdfField<string> getPartId() const;
            void setPartId(StdfField<string> partid);

            const StdfField<string> getPartText() const;
            void setPartText(StdfField<string> parttxt);

            const StdfField<CharArray> getPartFix() const;
            void setPartFix(StdfField<CharArray> partfix);

            const int getSeqId() const;
            void setSeqId(int seqid);

            void readFields(char *buf);

        protected:
            Prr();

        private:
            StdfField<int> head_num;
            StdfField<int> site_num;
            StdfField<vector<bool> > part_flag;
            StdfField<int> num_test;
            StdfField<int> hard_bin;
            StdfField<int> soft_bin;
            StdfField<int> x_coord;
            StdfField<int> y_coord;
            StdfField<long> test_t;
            StdfField<string> part_id;
            StdfField<string> part_txt;
            StdfField<CharArray> part_fix;

            int seq_id;
            static map<string,int> seq_count;

            endian en;
            bool decodeFields;
        };

        /*
HEAD_NUM U*1 Test head number
SITE_NUM U*1 Test site number
PART_FLG B*1 Part information flag
NUM_TEST U*2 Number of tests executed
HARD_BIN U*2 Hardware bin number
SOFT_BIN U*2 Software bin number 65535
X_COORD I*2 (Wafer) X coordinate -32768
Y_COORD I*2 (Wafer) Y coordinate -32768
TEST_T U*4 Elapsed test time in milliseconds 0
PART_ID C*n Part identification length byte = 0
PART_TXT C*n Part description text length byte = 0
PART_FIX B*n Part repair information length
*/
    }	// namespace stdf
}		// namespace opsrc

#endif /*PRR_H_*/
